package com.itheima.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

//统一响应结果集
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private Integer code;
    private String msg;
    private Object data;

    //提供一些静态方法，方便controller中使用
    public static Result ok(String msg){
        return new Result(1,msg,null);
    }
    public static Result ok(String msg,Object data){
        return new Result(1,msg,data);
    }
    public static Result error(String msg){
        return new Result(0,msg,null);
    }
}
